package com.example.designpatterns.decorator;

// 具体装饰器：为文本添加下划线效果
public class UnderlineDecorator extends TextDecorator {
    public UnderlineDecorator(TextComponent textComponent) {
        super(textComponent);
    }
    
    @Override
    public String getContent() {
        String content = textComponent.getContent();
        StringBuilder underline = new StringBuilder();
        for (int i = 0; i < content.length(); i++) {
            underline.append("-");
        }
        return content + "\n" + underline.toString();
    }

    @Override
    public void display() {
        System.out.println(getContent());
    }
} 